#include "log4c.h"
#include <string.h>

sg_log_t* sg_log4c_init(const char* filepath , sg_log_level level)
{
	sg_log_t* feedback = (sg_log_t*)malloc(sizeof(sg_log_t));
	if (NULL == feedback )
		return NULL;

	if (filepath)
		feedback->file = fopen(filepath,"w+");
	else
		feedback->file = stdout;
	feedback->level = level;
	return feedback;
}

void sg_log4c_destroy(sg_log_t* log)
{
	if (NULL == log)
		return;
	
	fclose(log->file);
	free(log);
}


void sg_log4c_flush(sg_log_t *log)
{
	fflush(log->file);
}
